/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package mygame;

import com.jme3.bullet.collision.PhysicsCollisionEvent;
import com.jme3.bullet.collision.PhysicsCollisionGroupListener;
import com.jme3.bullet.collision.PhysicsCollisionListener;
import com.jme3.bullet.collision.PhysicsCollisionObject;
import com.jme3.scene.Spatial;

/**
 *
 * @author dani
 */
public class EnemyTargetCollisionListener implements PhysicsCollisionListener {

    private Spatial target;

    public EnemyTargetCollisionListener(Spatial target) {
        this.target = target;
    }

    public void collision(PhysicsCollisionEvent event) {
        PhysicsCollisionObject objA = event.getObjectA();
        PhysicsCollisionObject objB = event.getObjectB();
        if (target.equals(event.getNodeA()) || target.equals(event.getNodeB())) {
            System.out.println("Collsion event");
            System.out.println(event.getObjectA());
            System.out.println(event.getObjectB());
        }
    }
}
